<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %> 
<%String path = request.getContextPath() ;%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
<div class="Wrapper">
<div>
<div id="pageInTab" class="pageInTab">
	<!-- 页签1-->
	<div tabid="tabA" lselected="true">
		<div class="searchArea">
			<!-- 搜索表单开始 -->
			<form id="searchBar">
				<div class="fieldset1 clearFix">
					<div class="FXBR">
						<div class="fieldBox">
							<div class="label">合同号</div>
							<div class="field">
								<input type="text" id="contractNo" name="contractNo" class="ui-textbox" ligerui="width: 160" value="">
							</div>
						</div>
						<div class="fieldBox">
							<div class="label">支付表号</div>
							<div class="field">
								<input type="text" id="paySchNo" name="paySchNo" class="ui-textbox" ligerui="width: 160" value="">
							</div>
						</div>
						
					<div class="clearFix"></div>
					
					
		            
				</div>
				<!-- 表单按钮 -->
					<div class="btnsBox formBtns notRight">
						<span id="searchBtn" class="sq-button-round">查询</span>
						<span id="clearBtn" class="sq-button-round">清空</span>
		            </div>
			</form>
			<!-- 搜索表单结束 -->
		</div>
		<!-- 列表显示块 -->
		<div id="ligergrid1" class="sq-grid"></div>
	</div>
	
</div>
</div>
</div>
<script type="text/javascript">
	var pageInApp={
		flag:false //tab页验证关闭
	};//to下一级子窗口 接口
	var pageInTab=null;//页签
	var loadedTabs=[];//页签
	var grid = null;
	
	$(function () {
		$("#searchBar").ligerForm();//初始化表单
	    initGrid();//初始化列表
	    searchBtnEvent();//查询按钮事件
	    clearBtnEvent();//清空按钮事件
	    
		
	
	});
		
	//查询参数
	function getSearchParams(){
		var form = new liger.get("searchBar");
		var data = form.getData();
		return data;
	}
	
	//初始化列表
	function initGrid(){
		$("#ligergrid1").ligerGrid({
			url:'<%=path%>/project/prjfile/prjFileRec/initList.do',
			method:'get',
			parms:getSearchParams(),
			columns:[
				{ display: '项目名称', name: 'prjNm',  align:'center', enabledSort:true,width:'150'},
				{ display: '客户名称', name: 'cstNm', align:'center', enabledSort:true},
				{ display: '合同号', name: 'lsCntNo',  align:'center', enabledSort:true,width:'150'},
				{ display: '支付表号', name: 'paySchNo', align:'center', enabledSort:true,width:'150'},
				{ display: '审核状态', name: 'stsCdNm', align:'center', enabledSort:true},
				{ display: '客户经理', name: 'cstMgrNm', align:'center', enabledSort:true},
				{ display: '所属机构', name: 'buOrgCdNm', align:'center', enabledSort:true},
				{ display: '省公司', name: 'prOrgCdNm', align:'center', enabledSort:true},
				
				{ display: '分公司', name: 'cyOrgCdNm', align:'center', enabledSort:true},
				//{ display: '创建时间', name: 'cfgDtlCdNm', align:'center', enabledSort:true},
				
				
				{display:'操作',
				isSort:false,
				align:'center',
				render:function (rowdata, rowindex, value){
					var h="";//流程中 审核通过不让改
						if(rowdata.stsCd=='0'||rowdata.stsCd=='4'){
			            	h+='<a class="sq-button-hasicon" href="javascript:toModifyPage(4,';
			                h+="'"+rowdata.payPrdDtlId+"',";
			                h+="'"+rowdata.prjId+"'";
			                h+=")\"><i class='sqBtnIco_4'></i>补充资料</a>";
						}else{
							h+='<a class="sq-button-hasicon" href="javascript:toModifyPage(0,';
							h+="'"+rowdata.payPrdDtlId+"',";
			                h+="'"+rowdata.prjId+"'";
			                h+=")\"><i class='sqBtnIco_4'></i>查看</a>";
						}
					return h;
				}
			}
				
			],
			pageSize:10,
			root:'rows',
			record:'total',
			hideLoadButton:false,
			width:'100%',
			height:'100%',
			heightDiff:-2,
			checkbox:true,//列表是否有选择框
			rownumbers:true,//列表是否有行号
			//选择行事件
			onSelectRow: function(rowdata, rowid, rowobj){
				
			},
			//取消选择行事件
			onUnSelectRow : function(rowdata, rowid, rowobj){
				
			}
		});
		grid = liger.get("ligergrid1");
		grid.setHeight(100);
		//grid.options.isSingleCheck = false;//列表是否为单选
	}
	
	//发起申请
	function warrantFileManageApply(paySchId,paySchNo,prjPrdDtlId,prjId,businessType,prjTypCd,prjNm,orgName,cstId,cstNm){
		//回调刷新列表
		var param = '<%=path%>/warrant/warrantfilemanage/toApplyPage.do?paySchId=' + paySchId + '&&paySchNo=' + paySchNo +'&&prjPrdDtlId='+prjPrdDtlId+'&&prjId='+prjId+'&&businessType='+businessType;
		param += '&&prjTypCd='+prjTypCd+'&&prjNm='+prjNm+'&&orgName='+orgName+'&&cstId='+cstId+'&&cstNm='+cstNm;
		
		Add_navTab('warrantFileManage'+paySchId,'申请',param, function () {
			grid.reload();
		});
	}
	
	
	//清空按钮事件
	function clearBtnEvent(){
		$("#clearBtn").click(function(event) {
			var form = liger.get("searchBar");
			$("#contractNo").val('');
			$("#paySchNo").val('');
		});
	}
	
	//查询按钮事件
	function searchBtnEvent(){
		$("#searchBtn").click(function(event) {
			var form = new liger.get("searchBar");
			var data = form.getData();
// 			alert(JSON.stringify(data));
			for (name in data){
				grid.setParm(name,data[name]);
			};
			grid.reload();
		});
	}
	
	
	
	//补充项目资料修改和查看
	function toModifyPage(ctrlKey,payPrdDtlId,prjId) {
		var title ="修改";
		if(ctrlKey ==0) {
			title ="查看";
		}
		Add_navTab(payPrdDtlId, "补充项目资料"+title, '<%=path%>/project/prjfile/prjFileRec/toModifyPage.do?ctrlKey='+ctrlKey+'&&id='+payPrdDtlId+'&&prjId='+prjId , function () {
			grid.reload();
		});
	}
	
	
	
	
	
	
</script>
</body>
</html>